package cn.melon.view.admin.store.ctr;

import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import org.apache.log4j.Logger;

import cn.melon.helper.LoggerHelper;
import cn.melon.mod.store.biz.GoodsBiz;
import cn.melon.mod.store.biz.impl.GoodsBizImpl;
import cn.melon.mod.store.entity.Goods;
import cn.melon.view.admin.store.AddGoodsDig;
import cn.melon.view.admin.store.GoodsInfoDig;

public class StoreGoodsInfoCtr implements ActionListener {

    private String TAG = LoggerHelper.makeLogTag(StorePanelCtr.class);
    private Logger DialogCtrLog = LoggerHelper.clientLogger();
    
    private GoodsInfoDig dialog = null;
    private GoodsBiz goodsBiz = new GoodsBizImpl();
    public StoreGoodsInfoCtr(GoodsInfoDig dia) {
        this.dialog = dia;
    }
    
    @Override
    public void actionPerformed(ActionEvent e) {
        DialogCtrLog.info(e.getActionCommand());
        switch (e.getActionCommand()) {
        case "确定":
            doOk();
            dialog.setVisible(false);
            break;
        case "取消":
            dialog.setVisible(false);
            break;
        default:
            break;
        }

    }
    private void doOk(){
        Goods goods = dialog.getGoods();
        goodsBiz.updateGoodsInfo(goods);
    }
}
